import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'package:zhongyiapp/pages/bookstore.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: bookscreen(),
    );
  }
}

class bookscreen extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
        backgroundColor: Colors.white,
        body: Column(children: const [
          SizedBox(
            height: 12.0,
          ),
          book(),
          SizedBox(
            height: 8.0,
          ),
          book1()
        ]));
  }
}

class book extends StatelessWidget {
  const book({Key? key}) : super(key: key);
  @override
  Widget build(BuildContext context) {
    return Container(
      width: 420,
      height: 50,
      child: Padding(
        padding: const EdgeInsets.all(8.0),
        child: Row(
          mainAxisAlignment: MainAxisAlignment.spaceBetween,
          children: <Widget>[
            IconButton(
              icon: Icon(Icons.arrow_back),
              onPressed: () {
                // 返回图标的点击事件
                Navigator.push(context,
                    MaterialPageRoute(builder: (context) => Bookscreen()));
              },
            ),
            Row(
              children: <Widget>[
                Icon(Icons.book),
                Text('加入书架'),
              ],
            ),
          ],
        ),
      ),
    );
  }
}

class book1 extends StatelessWidget {
  const book1({Key? key}) : super(key: key);
  @override
  Widget build(BuildContext context) {
    return Container(
      width: 390,
      height: MediaQuery.of(context).size.height - 100,
      child: SingleChildScrollView(
        child: Container(
          decoration: BoxDecoration(
              borderRadius: BorderRadius.circular(20.0),
              border: Border.all(color: Colors.grey, width: 2.0)),
          child: Column(
            children: <Widget>[
              Row(
                children: <Widget>[
                  SizedBox(
                    height: 30.0,
                    width: 60.0,
                  ),
                  Image.asset(
                    'assets/难经正义.jpg',
                    width: 270,
                    height: 400,
                  )
                ],
              ),
              Row(
                children: <Widget>[
                  Expanded(
                      child: Text(
                    '  《难经正义》，医经著作。六卷。清代叶霖撰于1895年。叶氏认为《难经》一书"理趣深远，非浅学得窥堂奥"，遂参历代医学大家对《难经》的注疏，以《内经》原文予以对照排比，诠释发挥。以《内经》为医学之根本，故以"正义"名篇。全书辩论精要，考证颇详。现有《珍本医书集成》本',
                    style: TextStyle(fontSize: 16.0),
                  ))
                ],
              ),
              SizedBox(
                height: 30.0,
              ),
              Row(
                children: <Widget>[
                  SizedBox(
                    width: 20.0,
                  ),
                  Container(
                    height: 50.0,
                    width: 150,
                    decoration: BoxDecoration(
                      color: const Color.fromARGB(255, 197, 195, 195),
                      borderRadius: BorderRadius.circular(10.0),
                    ),
                    child: Row(
                      mainAxisAlignment: MainAxisAlignment.spaceBetween,
                      children: <Widget>[
                        SizedBox(
                          width: 3.0,
                        ),
                        Text(
                          '字数',
                        ),
                        Text('8.3万字'),
                        SizedBox(
                          width: 3.0,
                        )
                      ],
                    ),
                  ),
                  SizedBox(
                    width: 35.0,
                  ),
                  Container(
                    height: 50.0,
                    width: 150,
                    decoration: BoxDecoration(
                      color: const Color.fromARGB(255, 197, 195, 195),
                      borderRadius: BorderRadius.circular(10.0),
                    ),
                    child: Row(
                      mainAxisAlignment: MainAxisAlignment.spaceBetween,
                      children: <Widget>[
                        SizedBox(
                          width: 3.0,
                        ),
                        Text(
                          '目录',
                        ),
                        Text('88章'),
                        SizedBox(
                          width: 3.0,
                        )
                      ],
                    ),
                  )
                ],
              ),
              SizedBox(
                height: 30.0,
              ),
              Row(
                children: <Widget>[
                  SizedBox(
                    width: 27.0,
                  ),
                  ElevatedButton(
                    onPressed: () {
                      // 按钮点击事件
                      print('Button pressed');
                    },
                    child: Text(
                      '开始听书',
                      style: TextStyle(fontSize: 25.0),
                    ),
                    style: ElevatedButton.styleFrom(
                      foregroundColor: Color.fromARGB(128, 191, 164, 124),
                      backgroundColor: const Color.fromARGB(255, 246, 244, 244),
                      // 按钮的文字颜色
                    ),
                  ),
                  SizedBox(
                    width: 35.0,
                  ),
                  ElevatedButton(
                    onPressed: () {
                      // 按钮点击事件
                      print('Button pressed');
                    },
                    child: Text(
                      '开始阅读',
                      style: TextStyle(fontSize: 25.0),
                    ),
                    style: ElevatedButton.styleFrom(
                      foregroundColor: Colors.white,
                      backgroundColor:
                          Color.fromARGB(128, 191, 164, 124), // 按钮的文字颜色
                    ),
                  ),
                ],
              ),
            ],
          ),
        ),
      ),
    );
  }
}
